version 13
set more off
  quietly log
  local logon = r(status)
  if "`logon'" == "on" { 
	log close 
	}
log using boehmke-witmer2020iga-analyze, replace text


/*		********************************************************************	*/
/*     	File Name:		boehmke-witmer2020iga-analyze.do						*/
/*     	Date:   		April 23, 2021											*/
/*      Author: 		Frederick J. Boehmke									*/
/*      Purpose:		This file replicates the negative binomial analysis in 	*/
/*						Table 2 of the number of bills lobbied on per tribal 	*/
/*						nation per biennium.									*/
/*      Input File:		boehmke-witmer2020iga.dta								*/
/*      Output File:	boehmke-witmer2020iga-analyze.log						*/
/*		********************************************************************	*/


use boehmke-witmer2020iga, clear

	
	/******************************/
	/* The two models in Table 2. */
	/******************************/
		
		/* Model 1: Gaming-related bills (casinos, lotteries, race tracks). */
	
nbreg subj_gamrel gaming tribepop pcpinc unemploy ed_hs age_med area_water area_land i.year, cluster(code)

		/* First difference for gaming-related bills. */

	margins, predict(n) atmeans at(year = 2006 gaming = (0 1))

		/* Model 1: Non-gaming related bills. */
	
nbreg subj_nongrel gaming tribepop pcpinc unemploy ed_hs age_med area_water area_land i.year, cluster(code)

		/* First difference for non-gaming-related bills. */

	margins, predict(n) atmeans at(year = 2006 gaming = (0 1))

	
	/**************************/
	/* Some alternate models. */
	/**************************/
		
		/* Proportion of bills that are related to gaming. */
		
glogit subj_gamrel totbills gaming tribepop pcpinc unemploy ed_hs age_med area_water area_land i.year

		/* Count models of all bills, then counts of Assembly and Senate bills separately. */
		
nbreg totbills gaming tribepop pcpinc unemploy ed_hs age_med area_water area_land i.year, cluster(code)

nbreg assbills gaming tribepop pcpinc unemploy ed_hs age_med area_water area_land i.year, cluster(code)

nbreg senbills gaming tribepop pcpinc unemploy ed_hs age_med area_water area_land i.year, cluster(code)

		/* Count models of gaming bills (casinos) versus non-gaming bills. */
		/* Then proportion of bills that are gaming. */

nbreg subj_gam gaming tribepop pcpinc unemploy ed_hs age_med area_water area_land i.year, cluster(code)

nbreg subj_nong gaming tribepop pcpinc unemploy ed_hs age_med area_water area_land i.year, cluster(code)

glogit subj_gam totbills gaming tribepop pcpinc unemploy ed_hs age_med area_water area_land i.year

log close
clear
exit
